package uy.com.dino.samefile.util;

import java.io.File;

public class FileUtil {

    public static String getFileName(File file) {
        String name = file.getName();
        name = name.substring(0, name.lastIndexOf("."));
        return name;
    }

    public static String getFileName(String fileName) {
        String name = fileName.substring(0, fileName.lastIndexOf("."));
        return name;
    }

    public static String getFileExtension(File file) {
        String fileName = file.getName();
        int index = fileName.lastIndexOf(".");
        String extension = fileName.substring(index, fileName.length());
        return extension;
    }

    public static String getFileExtension(String fileName) {
        int index = fileName.lastIndexOf(".");
        String extension = fileName.substring(index, fileName.length());
        return extension;
    }

    public static String getContentDirName(File file) {
        File parentFile = file.getParentFile();
        String name = parentFile.getName();
        return name;
    }

}
